#!/bin/bash
/usr/bin/expect <<-END
set timeout 2
spawn mysql
expect "mysql>" {send "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Zg.613099';\r"}
expect "mysql>" {send "flush privileges;\r"}
expect "mysql>" {send "create database hanhan;\r"} 
expect "mysql>" {send "stop slave;\r"}
expect "mysql>" {send "change master to master_host= '192.168.7.66' ,master_user= 'root'  ,master_password= 'Zg.613099' ,master_log_file= 'master-a-bin.000002' , master_log_pos=154;\r"}
expect "mysql>" {send "start slave;\r" }
expect "mysql>" {send "show slave status \G;\r"} 
expect "mysql>" {send "flush privileges;\r"}
expect "mysql>" {send "exit\r"}
expect efo
END

